<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript">
	var artAuctionGrid = null;
	var editAuctionDialog = null;
	var showAuctionDialog=null;
	$(function(){
		artAuctionGrid = $("#art_Auction_grid").ligerGrid({
				title : '拍卖主题列表',
                columns: [
					{
						display: '<a href="javascript:;" onclick="addArtAuction()">添加拍卖主题</a>', 
						name: 'identifier',
						width:200,
						isAllowHide: false, 
						isSort : false,
						render: function (record, rowindex, value, column){
							var html = '<a onclick="addArtPic(\''+ value + '\')" href="javascript:;">添加作品</a>&nbsp;<a onclick="showAuction(\''+ value + '\')" href="javascript:;">详情</a>&nbsp;<a onclick="updateAuction(\''+ value + '\')" href="javascript:;">更新</a>&nbsp;<a onclick="displayAuction(\''+ value + '\')" href="javascript:;">显示</a>&nbsp;<a onclick="hideAuction(\''+ value + '\')" href="javascript:;">关闭</a>&nbsp;'; 
							return html; 
						}
					},
				 { display: '当前状态', name: 'isShow',isSort : false,
	                  render: function(record, rowindex, value, column){
	                	  if(value){
	                		  return "<span>显示</span>"; 
	                	  }else{
	                		  return "<span>关闭</span>"; 
	                	  }
	                	 
	                  }},
	                  { display: '标题', name: 'title',isSort : false},
                { display: '开始日期', name: 'startDate', isSort : false },
                { display: '结束日期', name: 'endDate', isSort : false},
                { display: '开始时间', name: 'startTime', isSort : false},
                { display: '结束时间', name: 'endTime', isSort : false},
                { display: '封面', name: 'cover',isSort : false},
                { display: '创建时间', name: 'gmtCreated',isSort : false,
                  render: function(record, rowindex, value, column){
                	 return (new Date(value.time)).format("yyyy年MM月dd日 hh:mm:ss");
                  }}
                
                ], 
                pageSize:30,
                root :'list',
                record:'totalRecord',
                url: "/misc/auction/auctionGrid.htm", 
                width: '99%',height:'99%'
            });


	});
	//添加主题
	function addArtAuction(){
		editAuctionDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/auction/addAuction.htm", isResize: false ,modal:true,title:'添加艺术画'});
	
	}
	
	//详细情况
	function showAuction(auctionId){
		showAuctionDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/index/showAuctionDetail.htm?auctionId="+auctionId, isResize: false ,modal:true,title:'查看频道详情'});
	}
	function addArtPic(auctionId){
		addArtPicDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/auction/addAuctionPicWeb.htm?type=auction&classId="+auctionId,isResize: false ,modal:true,title:'添加作品'});
	}
	//关闭/开启 主题
	function displayAuction(auctionId){
		$.post("/misc/artAuction/openAuction.htm", {
			identifier:auctionId
		},function(data){
			if(data=="success"){
				artAuctionGrid.loadData();
				$.ligerDialog.success("开启成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//
	function hideAuction(auctionId){
		$.post("/misc/artAuction/hideAuction.htm", {
			identifier:auctionId
		},function(data){
			if(data=="success"){
				artAuctionGrid.loadData();
				$.ligerDialog.success("关闭成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//更新拍卖
	function updateAuction(id){
		editRoomDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artAuction/updateAuctionWeb.htm?auctionId="+id, isResize: false ,modal:true,title:'更新拍卖'});
	
	}
</script>
<div id="art_Auction_grid" style="margin:0; padding:0"></div>
